var data = [
  ['A1', 'A2'],
  ['B1', 'B2', 'B3'],
  ['C1', ['C2', 'C3']],
];


function descartes(list) {
  var result = [], pointArr = [], count = 1;
  for (var i = 0; i < list.length; i++) {
    pointArr.push(list[i].length)  // [2,3,2]
    count *= list[i].length     // 12 
  }
  console.log(pointArr)

  for (var i = 0; i < count; i++) {
    var _tmpPointArr = []
    var _point = i
    for (var j = pointArr.length - 1; j >= 0; j--) {
      //for (var j = 0; j < pointArr.length; j++) {  //这两种都可以，只是顺序不一样
      _tmpPointArr[j] = _point % pointArr[j]
      console.log(_point, pointArr[j], parseInt(_point / pointArr[j]), _tmpPointArr)
      _point = parseInt(_point / pointArr[j])
    }
    console.log("指针索引集合", _tmpPointArr)

    var _temp = []
    for (var k = 0; k < _tmpPointArr.length; k++) {
      // console.log(list, k, `打印输出`)
      _temp[k] = list[k][_tmpPointArr[k]]
    }
    result.push(_temp)
  }
  return result
}

const convertData = descartes(data)
console.log(convertData, convertData.length)
/*
[ 2, 3, 2 ]
0 2 0 [ <2 empty items>, 0 ]
0 3 0 [ <1 empty item>, 0, 0 ]
0 2 0 [ 0, 0, 0 ]
指针索引集合 [ 0, 0, 0 ]
1 2 0 [ <2 empty items>, 1 ]
0 3 0 [ <1 empty item>, 0, 1 ]
0 2 0 [ 0, 0, 1 ]
指针索引集合 [ 0, 0, 1 ]
2 2 1 [ <2 empty items>, 0 ]
1 3 0 [ <1 empty item>, 1, 0 ]
0 2 0 [ 0, 1, 0 ]
指针索引集合 [ 0, 1, 0 ]
3 2 1 [ <2 empty items>, 1 ]
1 3 0 [ <1 empty item>, 1, 1 ]
0 2 0 [ 0, 1, 1 ]
指针索引集合 [ 0, 1, 1 ]
4 2 2 [ <2 empty items>, 0 ]
2 3 0 [ <1 empty item>, 2, 0 ]
0 2 0 [ 0, 2, 0 ]
指针索引集合 [ 0, 2, 0 ]
5 2 2 [ <2 empty items>, 1 ]
2 3 0 [ <1 empty item>, 2, 1 ]
0 2 0 [ 0, 2, 1 ]
指针索引集合 [ 0, 2, 1 ]
6 2 3 [ <2 empty items>, 0 ]
3 3 1 [ <1 empty item>, 0, 0 ]
1 2 0 [ 1, 0, 0 ]
指针索引集合 [ 1, 0, 0 ]
7 2 3 [ <2 empty items>, 1 ]
3 3 1 [ <1 empty item>, 0, 1 ]
1 2 0 [ 1, 0, 1 ]
指针索引集合 [ 1, 0, 1 ]
8 2 4 [ <2 empty items>, 0 ]
4 3 1 [ <1 empty item>, 1, 0 ]
1 2 0 [ 1, 1, 0 ]
指针索引集合 [ 1, 1, 0 ]
9 2 4 [ <2 empty items>, 1 ]
4 3 1 [ <1 empty item>, 1, 1 ]
1 2 0 [ 1, 1, 1 ]
指针索引集合 [ 1, 1, 1 ]
10 2 5 [ <2 empty items>, 0 ]
5 3 1 [ <1 empty item>, 2, 0 ]
1 2 0 [ 1, 2, 0 ]
指针索引集合 [ 1, 2, 0 ]
11 2 5 [ <2 empty items>, 1 ]
5 3 1 [ <1 empty item>, 2, 1 ]
1 2 0 [ 1, 2, 1 ]
指针索引集合 [ 1, 2, 1 ]
[
  [ 'A1', 'B1', 'C1' ],
  [ 'A1', 'B1', [ 'C2', 'C3' ] ],
  [ 'A1', 'B2', 'C1' ],
  [ 'A1', 'B2', [ 'C2', 'C3' ] ],
  [ 'A1', 'B3', 'C1' ],
  [ 'A1', 'B3', [ 'C2', 'C3' ] ],
  [ 'A2', 'B1', 'C1' ],
  [ 'A2', 'B1', [ 'C2', 'C3' ] ],
  [ 'A2', 'B2', 'C1' ],
  [ 'A2', 'B2', [ 'C2', 'C3' ] ],
  [ 'A2', 'B3', 'C1' ],
  [ 'A2', 'B3', [ 'C2', 'C3' ] ]
] 12
*/